/*
  *文件名： SendService.java
  *版权： Copyright by 云天励飞 intellif.com 
  *描述： Description
  *创建人：mozping
  *创建时间： 2018/8/29 12:05
  *修改理由： 
  *修改内容：
*/
package com.intellif.mozping.kafka.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.integration.support.MessageBuilder;

/**
 * @author mozping
 * @version 1.0
 * @date 2018/8/29 12:05
 * @see SendService
 * @since JDK1.8
 */
@EnableBinding(MySource.class)
public class SendService {

    @Autowired
    private MySource mySource;


    public void sendMessage(String msg) {
        try {
            mySource.outPutChannel().send(MessageBuilder.withPayload(msg).build());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

